﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Kopain2.Forms
{

    /// <summary>Interaction logic for FormAbout.xaml
    /// </summary>
    public partial class FormAbout : Window
    {

        /// <summary>This property is a class that contains the information to show.
        /// </summary>
        private Information _information;

        /// <summary>This property contains tthe information to show.  By the time of writing it does not have to exist since we bind through myControl.DataContext = _information but I believe
        /// there is a way to bind a control's property to a form's property so keep it for now.
        /// </summary>
        public Information Infomation { get { return _information; } }

        /// <summary>This constructor also does things.
        /// </summary>
        public FormAbout()
        {
            InitializeComponent();

            System.Configuration.Configuration config = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.PerUserRoamingAndLocal);

            // Create the information to show.
            _information = new Information(config.FilePath);

            // Connnect the controls to the data.
            _userSettingsPathTextbox.DataContext = _information;
        }

        private void closeButton_Click(object sender, RoutedEventArgs e)
        {
            CloseForm();
        }

        private void Window_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Escape)
            {
                CloseForm();
            }
        }

        private void CloseForm()
        {
            this.Close();
        }

    }

}
